AmigaSoc UK

Changing Faces

Looks are everything. Whoever said beauty was on the inside was lying, at least when it comes to computers. Most good operating systems let their users make cosmetic adjustments, such as changing the background picture. Unix goes one better, it lets you change the entire Graphical User Interface (GUI) in one go. If you cast your mind back to the first tutorial you will remeber that the GUI is provided by an application known as a Window Manager. The Window Manager is started by the X server, the piece of software that provides a mechanism for running Graphical Programs. By changing your Window Manager you can change the entire appearance of your machine. If you don`t use the Windowing environment very often or are running low on disk space then you may not wish to install another Window Manager. If this is the case don`t worry because it is very easy to configure fvwm (one of the window managers supplied with the X11 distribution) to provide an more pleasent working enviroment.

One Step at a Time

The first step involved with the customisation of any of the Window Managers is to create your own .xinitrc file. Every time you start X it checks in your home directory for a file called .xinitrc. If this file is present it will use it, otherwise it will read the default file, /usr/local/X11R6.1/lib/X11/xinit. On most unix machines the system administrators would not let you anywhere near the default file, leaving you no option but to create you own. As you are both user and system administrator you can change the default file if you wish. Any changes you make to this file will effect every user on the system and not just you. It is for this reason that most people prefer to have their own personal configuration files in their home directory. The .xinitrc file tells the X Server which applications and most importantly which Window Manager you wish to run. A simple .xinitrc file would look something like listing 1. My preference is to keep things simple, so my .xinitrc file opens a single xterm window and an xconsole. The size and position of the windows are specified by the -geometry attributes. The file also contains entries for multiple window managers. Changing Window Manager is simply a matter of uncommenting a different line. The .xinitrc file only controls which applications are started when the X-Server initialises, in order to change the appearance of the window manager you must change it`s configuration file.
Listing 1 - .xinitrc
#!/bin/sh
#
# Chris` .xinitrc file
# Open an Xterm and a console on startup.

xconsole -geometry 400x70+6+20 &
xterm -geometry 80x24+6+108 &

# Window Manager, uncomment only 1 !
#exec twm
#exec fvwm2
exec amiwm
#exec afterstep
#exec olwm
#exec fvwm95
#exec olvwm


As with the xserver initialisation file the window manager will first check in your home directory for a configuration file. If it does not find an appropraite file there it will read the default file. Even if you are the only user of your NetBSD installation it is advisable to create a configuration file in your home directory if only for the simple reason that you will be able to find it easily should you wish to edit it it later. Fvwm2 expects to find a .fvwm2rc in your home directory. The simplest way to achieve this is to copy the default configuration file.

cp /usr/local/X11R6.1/lib/X11/fvwm2rc .fvwm2rc

you can then edit this file to suit your personal preferences. The first thing I did was to change the tiled fvwm backdrop to a more subtle blue colour. NetBSD has a long list of colour names that it understands and these are stored in the file /usr/local/X11R6.1/lib/X11/rgb.txt and include colours such as light sky blue, light salmon and peach puff. For fvwm a utility such as xsetroot can be used to change the background colour for the default grey. The second step in configuring the window manager to suit your needs is to edit the menu items. fvwm has two main menus. A Utilties menu that appears over the desktop and a Window Control menu that allows you to maximise and minimise windows. fvwm allows you to define the contents of both of these menus and even which mouse button you have to press for them to appear. I've edited the Utilities menu to include some of the applications installed as part of last months tutorial. I've also added the new window managers included on this months CD (AFCD21) to the restart menu, so you can switch window manager at the click of a mouse. Finally to complete the transformation of our desktop we`ll change the appearance of the button bar in the bottom right hand corner. The clock and CPU meter can stay, as they are quite useful, but the mail box flag is redundant on a machine that isn`t connected to a network. Instead we`ll replace this with a button to launch an xterm window. The icons that fvwm and indeed all the window managers use can be found in /usr/local/X11R6.1/include/X11/pixmaps. You must take care to choose an icon that is the right size and doesn`t contain to many colours for your window manager. I`ve also decided to rename my 3 virtual screens to misc, dev and web. You can see my new look fvwm screen here.

Also included on AFCD21 are 4 new window managers. They are all pre-compiled and come with installation and de-installation scripts, instructions can be found here. Best of all they can all co-exist on the same NetBSD installation, although you'll only be able to run one at a time. Olwm is the Openlook Window Manager produced by SUN Microsystems and provided with their "Solaris" Operating System. As window managers go it takes a very simple approach. It doesn`t feature start menus or button bars but just a fully configurable menu system. Olvwm is indentical except it provides virtual screens and a pager to select them. olwm is the simplist of the window managers to configure as listing 2 shows...

No!
Amiwm is the Amiga Window Manager. Not surprisingly it looks very much like an Amiga. It offers more configuration than olwm, multiple screens can be defined which pull down infront of each other just like the Amiga.
Add on modules allow various keyboard shortcuts to be defined and a background image can be placed on any virtual screen. Amiwm's main dissadvantage is that it doesn`t offer any more functionality than a standard workbench, and unfortunatly MCX and Magic Menu aren`t available for NetBSD (yet!). Amiwm uses an application called xloadimage to set the background image for each screen. The source code for this has been included on this months CD so you'll have to compile it yourself first. For those of you who have never tried this before, don't worry, it`s really very simple and it will be good practise for the coming tutorials!
Listing 2 - .openwin-menu
#.openwin-menu file
#define a pop-up menu with a sub-menu

"AmigaSoc UK" TITLE
"Programs" MENU
        "Xterm" xterm
        "File Manager" xfm
        SEPARATOR
        "Web Browser" arena
        "Text Editor" pico
        "XV" xv
        SEPARATOR
        "Clock" xclock
        "Calculator" xcalc
        "Performace Meter" xcpu
"Programs" END PIN
"Refresh Screen" REFRESH
"Properties..." PROPERTIES
"Lock Screen" "xlock -mode random"
"Exit..." EXIT

For those of you with Graphics Cards there is AfterStep, a Next style window manager. Afterstep features user definable menus and button bars, and an application loader called "Wharf" with the ability to "swallow" running applications. Oh and it also allows you to select any of the screen savers as an animated background. Now you can find out what living on board the Starship Enterprise would be like with the starfield module as your background!

The dreaded Start Menu!
Finally we come to Fvwm95, a Windows95 style window manager. Before you turn over in disgust wait, Fvwm95 has taken the good bits from Windows95 (the user interface) and thrown away the bad bits (the rest of the operating system). It is probably the most configurable window manager available offering a start menu, an applications menu, virtual screens, user definable keyboard shortcuts and 2 different button bars. Unfortunatly all this comes at a price. The configuration file is 865 lines long! Fortunatly with a few changes the supplied configuration is perfectly useable.


This article first appeared in the Christmas 1997 issue of Amiga Format and included a special festive application. X-Snow is a small hack to make it snow on your desktop. The snow settles on windows and icons and if you're lucky Father Christmas can be seen riding his sleigh in the background.

In the next article we'll be looking at shells and shell scripting